import React, { Component } from 'react';

class Ref extends Component {
    constructor(props){
        super(props)
        this.fileRef=React.createRef()
    }
    state={
        file:""
    }
    handleClick=(e) => {
        console.log(this.fileRef.current.files[0])
    }
    render() {
        return (
            <div>
                <input type="file" name="" id="" ref={this.fileRef}/>
                <button onClick={this.handleClick}>打印</button>
            </div>
        );
    }
}

export default Ref;